﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities.Presentation.PropertyEditing;
using System.Windows;
using System.Windows.Controls;
using System.ServiceModel.Channels;
using System.Windows.Data;

namespace WFDataBaseProject.Helpers
{
    public class CustomPropertyValueEditor:PropertyValueEditor
    {
        public CustomPropertyValueEditor()
        {
            this.InlineEditorTemplate = new DataTemplate();
            FrameworkElementFactory stack = new FrameworkElementFactory(typeof(StackPanel));
            stack.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
            FrameworkElementFactory label = new FrameworkElementFactory(typeof(Label));
            System.Windows.Data.Binding labelBinding = new System.Windows.Data.Binding("Value");
            label.SetValue(Label.ContentProperty, labelBinding);
            label.SetValue(Label.MinWidthProperty, 90.0);
            stack.AppendChild(label);
            FrameworkElementFactory editModeSwitch = new FrameworkElementFactory(typeof(EditModeSwitchButton));
            editModeSwitch.SetValue(EditModeSwitchButton.TargetEditModeProperty, PropertyContainerEditMode.Inline);
            stack.AppendChild(editModeSwitch);
            this.InlineEditorTemplate.VisualTree = stack;
        }

       
    }
}
